package com.dingwen.treasure.business.config;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 　MyWebMvcConfigurer: 后台解决跨域方式3：
 * 方式4： 前端配置代理即可
 * 　@author dingwen
 * 　@date 2022/8/8
 */
//@Configuration(proxyBeanMethods = false)
public class MyWebMvcConfigurer implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedOrigins("*")
                .allowedMethods("*")
                .allowCredentials(Boolean.TRUE)
                .maxAge(3600)
                .allowedHeaders("*");
    }
}
